{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['浙江农业.xlsx',\n",
       " '浙江商务服务业.xlsx',\n",
       " '浙江建筑业.xlsx',\n",
       " '浙江批发零售业.xlsx',\n",
       " '浙江省制造业.xlsx',\n",
       " '浙江酒店与技术服务业.xlsx',\n",
       " '浙江采矿业.xlsx']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "\n",
    "list = os.listdir('./fenlei/')\n",
    "list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tushare as ts\n",
    "ts.set_token('c2ed081aa3b67b6943570b10feb85dda0828ccc7a4daa0d7c14942a2')\n",
    "pro = ts.pro_api()\n",
    "\n",
    "for name in list:\n",
    "    df = pd.read_excel('./fenlei/'+name)\n",
    "    datas = df['代码'].tolist()[:-2]\n",
    "    df_datas = pd.DataFrame()\n",
    "    for data in datas:\n",
    "        df_datas=pd.concat([df_datas,ts.pro_bar(ts_code=data, adj='qfq', start_date='20201002', end_date='20211002')])\n",
    "    df_datas.to_excel('./datas/20201002-20211002'+name,index=False)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "c3ac3f88986c03f5f4ea9b167d463bfb61b25cb597313235fabe727a0f7e0da2"
  },
  "kernelspec": {
   "display_name": "Python 3.9.5 64-bit ('base': conda)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
